<?php

App::uses('AppHelper', 'View/Helper');
App::import('model', 'Property');

/**
 * Application helper
 *
 * Add your application-wide methods in the class below, your helpers
 * will inherit them.
 *
 * @package       app.View.Helper
 */
class PropertiesHelper extends AppHelper {

    public $helpers = array('Html');

    /**
     * getSeoLink
     */
    public function getProperty($id) {
        $Property = new Property();
        $Property->recursive = -1;
        $property = $Property->findById($id, array('id', 'name'));
        return $property;
    }

    /**
     * show status
     */
    public function showStatus($id, $status) {
        $url = $this->Html->url(array('controller' => 'properties', 'action' => 'admin_updateStatus'));
        if ($status == Property::show) {
            return "<div class='show-status' title='" . __('Click to Hide') . "' onclick=updateStatus('" . $url . "'," . $id . "," . Property::hide . ")>" . __("Show") . "</div>";
        }
        if ($status == Property::hide) {
            return "<div class='hide-status' title='" . __("Click to Show") . "' onclick=updateStatus('" . $url . "'," . $id . "," . Property::show . ")>" . __("Hide") . "</div>";
        }
    }
}
